import { defineStore } from 'pinia'

const state = () => ({
	betKeys: [],
	betInfos: []
})
const maxCount = 30;

export const userDiffOrderStore = defineStore({
	id: 'user_store_diff_order',
	state,
	actions: {
		addKey(key){
			this.betKeys.unshift(key);
			/*if(this.betKeys.length > maxCount) {
				this.betKeys = this.betKeys.slice(0, maxCount);
			}*/
		},
		addInfo(key, item) {
			this.betInfos[key] = item;
			for(let i in this.betInfos) {
				if(this.betKeys.indexOf(i) === -1) {
					try{
						delete this.betInfos[i];
					}catch (e){}
				}
			}
		}
	}
})